if ($defined(window.jQuery) && $type(jQuery.noConflict)=='function') {
jQuery.noConflict();
jQuery.noConflict();
}
function switchFontSize (ckname,val){
var bd = $E('body');
switch (val) {
case 'inc':
if (CurrentFontSize+1 < 7) {
bd.removeClass('fs'+CurrentFontSize);
CurrentFontSize++;
bd.addClass('fs'+CurrentFontSize);
}		
break;
case 'dec':
if (CurrentFontSize-1 > 0) {
bd.removeClass('fs'+CurrentFontSize);
CurrentFontSize--;
bd.addClass('fs'+CurrentFontSize);
}		
break;
default:
bd.removeClass('fs'+CurrentFontSize);
CurrentFontSize = val;
bd.addClass('fs'+CurrentFontSize);		
}
Cookie.set(ckname, CurrentFontSize,{duration:365});
}
function switchTool (ckname, val) {
createCookie(ckname, val, 365);
window.location.reload();
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function gkAddEvent(obj, evType, fn){ 
if (obj.addEventListener){ 
obj.addEventListener(evType, fn, false); 
return true; 
} else if (obj.attachEvent){ 
var r = obj.attachEvent("on"+evType, fn); 
return r; 
} else { 
return false; 
} 
}
window.addEvent('load', function() {
new SmoothScroll(); 
if($('stylearea')){
$$('.style_switcher').each(function(element,index){
element.addEvent('click',function(event){
var event = new Event(event);
event.preventDefault();
changeStyle(index+1);
});
});
}
if($('btn_login') || $('btn_register')) {
var popup_overlay = $('gk-popup-overlay');
popup_overlay.setStyle('display', 'block');
var popup_overlay_fx = new Fx.Style(popup_overlay, 'opacity', {duration:200}).set(0);
var opened_popup = null;
var popup_login = null;
var popup_login_h = null;
var popup_login_fx = null;
var popup_register = null;
var popup_register_h = null;
var popup_register_fx = null;    	
if($('btn_login')) {
popup_login = $('gk-popup-login');
popup_login.setStyle('display', 'block');
popup_login_h = popup_login.getElement('.gk-popup-wrap').getSize().size.y + 8;
popup_login_fx = new Fx.Styles(popup_login, {duration:200, transition: Fx.Transitions.Circ.easeInOut}).set({'opacity': 0, 'height': 0, 'margin-top':0}); 
$('btn_login').addEvent('click', function(e) {
new Event(e).stop();
popup_overlay_fx.start(0.85);
popup_login_fx.start({'opacity':1, 'margin-top': -popup_login_h / 2, 'height': popup_login_h});
opened_popup = 'login';
});
}    	
if($('btn_register')) {
popup_register = $('gk-popup-register');
popup_register.setStyle('display', 'block');
popup_register_h = popup_register.getElement('.gk-popup-wrap').getSize().size.y + 8;
popup_register_fx = new Fx.Styles(popup_register, {duration:200, transition: Fx.Transitions.Circ.easeInOut}).set({'opacity': 0, 'height': 0, 'margin-top':0}); 
$('btn_register').addEvent('click', function(e) {
new Event(e).stop();
popup_overlay_fx.start(0.85);
popup_register_fx.start({'opacity':1, 'margin-top': -popup_register_h / 2, 'height': popup_register_h});
opened_popup = 'register';
});
}   	
popup_overlay.addEvent('click', function() {
if(opened_popup == 'login')	{
popup_overlay_fx.start(0);
popup_login_fx.start({
'opacity' : 0,
'height' : 0,
'margin-top': 0
});
}    		
if(opened_popup == 'register') {
popup_overlay_fx.start(0);
popup_register_fx.start({
'opacity' : 0,
'height' : 0,
'margin-top': 0
});
}	
});
}
});
function changeStyle(style){
var file1 = tmplurl+'/css/style'+style+'.css';
new Asset.css(file1);
new Cookie.set('gk53_style',style,{duration: 200,path: "/"});
}
function JCaptionCheck() { 
return (typeof(JCaption) == "undefined")?  false: true; 
}
if(!JCaptionCheck()) {
var JCaption = new Class({
initialize: function(selector)
{
this.selector = selector;
var images = $$(selector);
images.each(function(image){ this.createCaption(image); }, this);
},
createCaption: function(element)
{
var caption   = document.createTextNode(element.title);
var container = document.createElement("div");
var text      = document.createElement("p");
var width     = element.getAttribute("width");
var align     = element.getAttribute("align");
var docMode = document.documentMode;
if (!align)
align = element.getStyle("float"); 
if (!align) 
align = element.style.styleFloat;
text.appendChild(caption);
text.className = this.selector.replace('.', '_');
if (align=="none") {
if (element.title != "") {
element.parentNode.replaceChild(text, element);
text.parentNode.insertBefore(element, text);
}
} else {
element.parentNode.insertBefore(container, element);
container.appendChild(element);
if ( element.title != "" ) {
container.appendChild(text);
}
container.className   = this.selector.replace('.', '_');
container.className   = container.className + " " + align;
container.setAttribute("style","float:"+align);
if (!docMode|| docMode < 8) {
container.style.width = width + "px";
}
}
}
});
document.caption = null;
window.addEvent('load', function() {
var caption = new JCaption('img.caption')
document.caption = caption
});
}